package cn.edu.gdpt.mobile213.mobile2121606097wjc0414;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

public class carlineadapter extends RecyclerView.Adapter<carlineadapter.ViewHolder>{
    private String[] carlineno={"轿车车型生产环节1","轿车汽车生产环节2"};
    private String[] carlinename={"轿车汽车放置底盘","轿车汽车左前悬挂"};

    public carlineadapter(String[] carlineno,String[] carlinename){
        this.carlineno=carlineno;
        this.carlinename=carlinename;
    }
    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view= LayoutInflater.from(parent.getContext())
                .inflate(R.layout.item_rv_main_car,parent,false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
    holder.tvCarlIneNo.setText(carlineno[position]);
    holder.tvcarlinename.setText(carlinename[position]);
    }

    @Override
    public int getItemCount() {
        return carlineno.length;
    }

    class ViewHolder extends RecyclerView.ViewHolder{
        TextView tvCarlIneNo,tvcarlinename;


        public ViewHolder(@NonNull View itemView) {
            super(itemView);
            tvCarlIneNo=itemView.findViewById(R.id.tvitemcarlineno);
            tvcarlinename=itemView.findViewById(R.id.tvitemcarlinename);
        }
    }
}
